package com.chapter10;

import java.util.Objects;

public class ColoPoint extends Point{

    private String color;

    public ColoPoint(int x,int y,String color){
        super(x,y);
        this.color=color;
    }

//    @Override
//    public boolean equals(Object o) {
////        if (!(o instanceof ColoPoint))
////            return false;
////        return super.equals(o) && ((ColoPoint)o).color==color;
//
//        if (!(o instanceof Point))
//            return false;
//        if (!(o instanceof ColoPoint))
//            return o.equals(this);
//        return super.equals(o) && ((ColoPoint)o).color==color;
//    }

    public static void main(String[] args) {
//        Point p=new Point(1,2);
//        ColoPoint cp=new ColoPoint(1,2,"red");
//
//        System.out.println(p.equals(cp));
//        System.out.println(cp.equals(p));

        ColoPoint p1=new ColoPoint(1,2,"red");
        Point p2=new Point(1,2);
        ColoPoint p3=new ColoPoint(1,2,"BLUE");

        System.out.println(p1.equals(p2));
        System.out.println(p2.equals(p3));

    }

}
